#include "ogl/gut/Image.h"
#include "ogl/gut/Dictionary.h"
#include "imgui/Editor.h"

using namespace Ogl::Gut;



template <>
bool ImGui::Editor::Edit(const std::string& label, Ogl::Gut::Image::HD& inst)
{


    EditInst<int>("Width", inst.m_Width);
    EditInst<int>("Height", inst.m_Height);
    EditInst<int>("NrComponent", inst.m_NrComponent);
    // EditInst<bool>("Hdr", *(bool*)&inst.m_Hdr);
    CheckBoxInst<int>("hdr", inst.m_Hdr);

    return false;
}


template <>
bool ImGui::Editor::Edit(const std::string& label, Ogl::Gut::Image::Desc& inst)
{
    CheckBoxInst<int>("hdr", inst.m_hdr);
    EditInst<int>("req Com", inst.m_ReqComponent);
    EditInst<std::string>("Path", inst.m_Path);

    return false;
}


template <>
bool ImGui::Editor::Edit(const std::string& label, Ogl::Gut::Image& inst)
{
    if (Editor::TreeNode("Header", inst.m_BitFlag, 0))
    {
        EditInst("", inst.m_HD);
        ImGui::TreePop();
    }
    if (Editor::TreeNode("Desc", inst.m_BitFlag, 1))
    {
        EditInst("", inst.m_Desc);
        ImGui::TreePop();
    }

    if (ImGui::Button("reload image"))
    {
        inst.Init();

    }
    return false;
}
